﻿using Knlght.Model.Sys;
using Knlght.Service;
using Knlght.Web.Infrastructure.Menus;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using System.Web.Security;

namespace Knlght.Web.Areas.Manage.Controllers
{
    
    [Knlght.Web.Infrastructure.Filters.EJAuthorize(LoginUrl = "/Manage/Account/Login", Roles = "Admin")]
    public abstract class BaseAdminController : BaseController
    {

        protected string GetUserId()
        {
            return this.User.Identity.Name;
        }

        protected Administrators GetUser()
        {
            var rp = new Cache();
            return rp.GetCache<Administrators>("Admin_" + this.User.Identity.Name);                     
        }
        protected override void Initialize(RequestContext requestContext)
        {
            base.Initialize(requestContext);
            this.ValidateRequest = false;
        }
    }
}